package com.yipao.db.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import com.yipao.db.domain.YipaoPermission;
import com.yipao.db.domain.YipaoPermissionExample;

/**
 * @author tianhao
 */
public interface PermissionMapper {

    long countByExample(YipaoPermissionExample example);


    int deleteByExample(YipaoPermissionExample example);


    int deleteByPrimaryKey(Integer id);


    int insert(YipaoPermission record);


    int insertSelective(YipaoPermission record);


    YipaoPermission selectOneByExample(YipaoPermissionExample example);


    YipaoPermission selectOneByExampleSelective(@Param("example") YipaoPermissionExample example, @Param("selective") YipaoPermission.Column... selective);


    List<YipaoPermission> selectByExampleSelective(@Param("example") YipaoPermissionExample example, @Param("selective") YipaoPermission.Column... selective);


    List<YipaoPermission> selectByExample(YipaoPermissionExample example);


    YipaoPermission selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") YipaoPermission.Column... selective);


    YipaoPermission selectByPrimaryKey(Integer id);


    YipaoPermission selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);

    /**
     * 查询角色是否有某项权限
     *
     * @param permissionList 权限
     * @param roleIdList     角色
     * @param deleted        删除状态
     * @return
     */
    int queryCountUserPermissionByRoleId(@Param("permissionList") List<String> permissionList,
                                         @Param("roleIdList") List<Integer> roleIdList,
                                         @Param("deleted") Integer deleted);

    int updateByExampleSelective(@Param("record") YipaoPermission record, @Param("example") YipaoPermissionExample example);


    int updateByExample(@Param("record") YipaoPermission record, @Param("example") YipaoPermissionExample example);


    int updateByPrimaryKeySelective(YipaoPermission record);


    int updateByPrimaryKey(YipaoPermission record);


    int logicalDeleteByExample(@Param("example") YipaoPermissionExample example);


    int logicalDeleteByPrimaryKey(Integer id);
}
